#!/bin/sh

mkdir $1
cd $1
LOG_FILE=`echo ${1}_log.txt`
touch $LOG_FIlE
PARENT_URL_ELEMENT=`echo $1|cut -c 1`

downloadfile () {
		wget $1
		if [ $? -eq 0 ]
			then
			echo "$1": DONE >>$LOG_FILE
		elif [ $? -eq 1 -o $? -eq 8 ]
			then
			echo "$1": FAIL >> $LOG_FILE
		fi
		}
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fb_.jpg
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fg_.jpg
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_rtb_.jpg
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_rtg_.jpg
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_dfu_bul.pdf
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_dfu_eng.pdf
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_dfu_aen.pdf
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_pss_bul.pdf
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_pss_eng.pdf
downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_pss_aen.pdf
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_dfu_eng.pdf
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_pss_eng.pdf
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__ff_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fm_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fp_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fs_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fv_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}__fw_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_com_.jpg
#downloadfile www.p4c.philips.com/files/$PARENT_URL_ELEMENT/$1/${1}_cow_.jpg

#downloadfile www.p4c.philips.com/files/3/$1/${1}_{_ff_,_fb_,_fg_,_fm_,_fp_,_fs_,_fv_,_fw_,com_,cow}.jpg